//载入一些初始化的简单样式
import 'css/common.css';
import 'css/font-awesome.css';
import 'css/main.css'

// vue 插件
import Vue from 'vue';
import VueRouter from 'vue-router';
import VueResource from 'vue-resource';
import VueAnimatedList from 'vue-animated-list'


// 载入组件
import Home from './components/home';
import SelectDemo from './components/select-demo';
import ListDemo from './components/list-demo';
import Navbar from './components/navbar';
import Select from './components/select-v2';
import List from './components/list';
import CheckboxDemo from './components/text-demo';
import VuexDemo from './components/vuex-demo';
import Checkbox from './components/text';
import Editable from './components/editable';

// 载入指令

import IsBlur from './directives/is-blur';

// 注册指令

Vue.directive('is-blur', IsBlur);

// 注册组件
Vue.component('navbar',Navbar);
Vue.component('data-select', Select);
Vue.component('list', List);
Vue.component('data-checkbox', Checkbox);
Vue.component('editable', Editable);

// 使用vue插件
Vue.use(VueRouter);
Vue.use(VueResource);
Vue.use(VueAnimatedList)

var router = new VueRouter();


// 路由
router.map({
    '/home': {
        name: 'home',
        component: Home
    },
    '/': {
        component: Home
    },
    '/select-demo': {
        name: 'select-demo',
        component: SelectDemo
    },
    '/list-demo':{
        name: 'list-demo',
        component: ListDemo
    },
    '/text-demo':{
        name: 'checkbox',
        component:CheckboxDemo
    },
    '/vuex-demo':{
        name: 'checkbox',
        component:VuexDemo
    }
})

router.start({}, '#app');
router.afterEach(function(){
    router.app.$broadcast('router-change');
});
